namespace Jackie.Utility.CustomExtension
{
    using System;
    using System.IO;
    using System.Security.Cryptography;

    public static class ExtensionFileInfo
    {
        public static string GetContentHashCode(this FileInfo file)
        {
            string hashCode = string.Empty;
            if (file.Exists)
            {
                using (var fileStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))
                {
                    hashCode = BitConverter.ToString(MD5.Create().ComputeHash(fileStream));
                }
            }
            return hashCode;
        }
    }
}
